package com.qingke.test;

public class Book {
	private String name;
	private Author[] author;
	private double price;
	private int qty=0;
	public Book(String name,Author[] author,double price){
		this.name=name;
		this.author=author;
		this.price=price;
	}
	public Book(String name,Author[] author,double price,int qty){
		this.name=name;
		this.author=author;
		this.price=price;
		this.qty=qty;
	}
	public String getName(){
		return name;
	}
	public Author[] getAuthor(){
		return author;
	}
	public double getPrice(){
		return price;
	}
	public void setPrice(double price){
		this.price=price;
	}
	public int getQty(){
		return qty;
	}
	public void setQty(int qty){
		this.qty=qty;
	}
	public String toString(){
		String str="Book[name="+name+",authors={";
		String authorsStr="";
		for(Author a:author){
			authorsStr+=a.toString();
			if(!a.equals(author[author.length-1]))
				authorsStr+=",";
		}
		str+=authorsStr+"},price="+price+",qty="+qty+"]";
		return str;
	}
	public String getAuthorName(){
		String str="";
		for(Author a:author){
			str+=a.toString();
			if(!a.equals(author[author.length-1]))
				str+=",";
		}
		return str;
	}
	
}
